package com.team7.happycommunity.parkservice.controller;

import com.team7.happycommunity.parkservice.common.CommonResult;
import com.team7.happycommunity.parkservice.pojo.ParkingInfo;
import com.team7.happycommunity.parkservice.service.ParkingInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/parkinginfo")
public class ParkingInfoController {

    @Autowired
    ParkingInfoService parkingInfoService;

    @GetMapping("/mlist")
    @ResponseBody
    public CommonResult mlist(@RequestParam(defaultValue = "2") int areaid){
        List<ParkingInfo> list = parkingInfoService.getMList(areaid);
        return CommonResult.success(list);
    }
}
